<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Class: TwitterPhoto</title>

	<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

	<script src="./js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="class">

	<div id="metadata">
		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="./lib/twitter-photos_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="lib/twitter-photos.rb">lib/twitter-photos.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			
			<div id="parent-class-section" class="section">
				<h3 class="section-header">Parent</h3>
				
				<p class="link">Object</p>
				
			</div>
			

			<!-- Namespace Contents -->
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#M000001">::find_by_username</a></li>
					
					<li><a href="#M000002">::get_photos_by</a></li>
					
					<li><a href="#M000000">::new</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
		</div>

		<div id="project-metadata">
			
			
			<div id="fileindex-section" class="section project-section">
				<h3 class="section-header">Files</h3>
				<ul>
				
					<li class="file"><a href="./LICENSE.html">LICENSE</a></li>
				
					<li class="file"><a href="./README_rdoc.html">README.rdoc</a></li>
				
				</ul>
			</div>
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="./images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="./DateTime.html">DateTime</a></li>
				
					<li><a href="./TimeMod.html">TimeMod</a></li>
				
					<li><a href="./TwitterPhoto.html">TwitterPhoto</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="class">TwitterPhoto</h1>

		<div id="description">
			
		</div>

		<!-- Constants -->
		
		<div id="constants-list" class="section">
			<h3 class="section-header">Constants</h3>
			<dl>
			
				<dt><a name="TWITPIC_URL">TWITPIC_URL</a></dt>
				
				<dd class="description missing-docs">(Not documented)</dd>
				
			
				<dt><a name="TWEETPHOTO_URL">TWEETPHOTO_URL</a></dt>
				
				<dd class="description missing-docs">(Not documented)</dd>
				
			
				<dt><a name="YFROG_URL">YFROG_URL</a></dt>
				
				<dd class="description missing-docs">(Not documented)</dd>
				
			
				<dt><a name="TWITGOO_URL">TWITGOO_URL</a></dt>
				
				<dd class="description missing-docs">(Not documented)</dd>
				
			
			</dl>
		</div>
		

		<!-- Attributes -->
		
		<div id="attribute-method-details" class="method-section section">
			<h3 class="section-header">Attributes</h3>

			
			<div id="username-attribute-method" class="method-detail">
				<a name="username"></a>
				
				<a name="username="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">username</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				<p class="missing-docs">(Not documented)</p>
				
				</div>
			</div>
			
			<div id="thumb-attribute-method" class="method-detail">
				<a name="thumb"></a>
				
				<a name="thumb="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">thumb</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				<p class="missing-docs">(Not documented)</p>
				
				</div>
			</div>
			
			<div id="date-attribute-method" class="method-detail">
				<a name="date"></a>
				
				<a name="date="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">date</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				<p class="missing-docs">(Not documented)</p>
				
				</div>
			</div>
			
			<div id="tweet-attribute-method" class="method-detail">
				<a name="tweet"></a>
				
				<a name="tweet="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">tweet</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				<p class="missing-docs">(Not documented)</p>
				
				</div>
			</div>
			
			<div id="url-attribute-method" class="method-detail">
				<a name="url"></a>
				
				<a name="url="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">url</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				<p class="missing-docs">(Not documented)</p>
				
				</div>
			</div>
			
		</div>
		

		<!-- Methods -->
		
		<div id="public-class-method-details" class="method-section section">
			<h3 class="section-header">Public Class Methods</h3>

		
			<div id="find-by-username-method" class="method-detail ">
				<a name="M000001"></a>

				<div class="method-heading">
				
					<span class="method-name">find_by_username</span><span
						class="method-args">(username)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Find all <a href="TwitterPhoto.html">TwitterPhoto</a> objects with the
username of the given value. Example: <a
href="TwitterPhoto.html#M000001">TwitterPhoto.find_by_username</a>(&#8216;bookis&#8217;)
</p>
					

					
					<div class="method-source-code"
						id="find-by-username-source">
<pre>
<span class="ruby-comment cmt"># File lib/twitter-photos.rb, line 25</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">find_by_username</span>(<span class="ruby-identifier">username</span>)
    <span class="ruby-identifier">found</span> = []
    <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">TwitterPhoto</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">found</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">o</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">username</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">username</span>
    }
    <span class="ruby-identifier">found</span>.<span class="ruby-identifier">sort_by</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">date</span>}
  <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
			<div id="get-photos-by-method" class="method-detail ">
				<a name="M000002"></a>

				<div class="method-heading">
				
					<span class="method-name">get_photos_by</span><span
						class="method-args">(username, options={})</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Fetch photos from Twitpic, yFrog, Twitgoo, and TweetPhoto using the
username of the twitter user. Returns an array of <a
href="TwitterPhoto.html">TwitterPhoto</a> objects. Takes options to exclude
any of the photo sevices. Example: <a
href="TwitterPhoto.html#M000002">TwitterPhoto.get_photos_by</a>(&#8216;bookis&#8217;,
:tweetphoto => false, :yfrog => true, :twitpic => true, :twitgoo => false)
All options default to true
</p>
					

					
					<div class="method-source-code"
						id="get-photos-by-source">
<pre>
<span class="ruby-comment cmt"># File lib/twitter-photos.rb, line 36</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_photos_by</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">options</span>={})
    <span class="ruby-ivar">@pix</span> = []
    <span class="ruby-identifier">hydra</span> = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Hydra</span>.<span class="ruby-identifier">new</span>
    
    <span class="ruby-identifier">twitpic_request</span>  = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{TWITPIC_URL}/photos/#{username}&quot;</span>, <span class="ruby-identifier">:timeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5000</span>)
    <span class="ruby-identifier">twitpic_request</span>.<span class="ruby-identifier">on_complete</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">twitpics</span> = <span class="ruby-constant">Nokogiri</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
      <span class="ruby-identifier">twitpics</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">&quot;//div[@class='profile-photo-img']/a&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">url</span> = <span class="ruby-identifier">row</span>[<span class="ruby-identifier">:href</span>]
        <span class="ruby-identifier">twitpic_request</span> = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{TWITPIC_URL}#{url}&quot;</span>, <span class="ruby-identifier">:timeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5000</span>)
        <span class="ruby-identifier">twitpic_request</span>.<span class="ruby-identifier">on_complete</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">twitpic</span><span class="ruby-operator">|</span>
          <span class="ruby-keyword kw">begin</span>
            <span class="ruby-identifier">twitpic</span> = <span class="ruby-constant">Nokogiri</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">twitpic</span>.<span class="ruby-identifier">body</span>)
            <span class="ruby-comment cmt"># pic = []</span>
            <span class="ruby-constant">TwitterPhoto</span>.<span class="ruby-identifier">new</span>(
                             <span class="ruby-node">&quot;#{TWITPIC_URL}/show/thumb#{url}.jpg&quot;</span>,
                             <span class="ruby-identifier">twitpic</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">&quot;//div/div[@id='view-photo-caption']&quot;</span>).<span class="ruby-identifier">text</span>,
                             <span class="ruby-identifier">twitpic</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">&quot;//div/div[@id='photo-info']&quot;</span>).<span class="ruby-identifier">text</span>,
                             <span class="ruby-identifier">twitpic</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">&quot;//img[@class='photo']&quot;</span>)[<span class="ruby-identifier">:src</span>],
                             <span class="ruby-identifier">username</span>
                            )
          <span class="ruby-keyword kw">rescue</span>
          <span class="ruby-keyword kw">end</span>
        <span class="ruby-keyword kw">end</span>
        <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">queue</span> <span class="ruby-identifier">twitpic_request</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-identifier">yfrog_request</span>  = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">YFROG_URL</span>, <span class="ruby-identifier">:params</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:username</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">username</span>}, <span class="ruby-identifier">:timeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5000</span>)
    <span class="ruby-identifier">yfrog_request</span>.<span class="ruby-identifier">on_complete</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">yfrogs</span> = <span class="ruby-constant">Nokogiri</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
      <span class="ruby-identifier">yfrogs</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">&quot;//div[@class='timeline_entry']&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span>
         <span class="ruby-identifier">url</span> = <span class="ruby-identifier">row</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">&quot;div/div[@class='thumbtweet' ]/a&quot;</span>)[<span class="ruby-identifier">:href</span>]
         <span class="ruby-identifier">yfrog_request</span> = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">:timeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5000</span>)
         <span class="ruby-identifier">yfrog_request</span>.<span class="ruby-identifier">on_complete</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">yfrog</span><span class="ruby-operator">|</span>
           <span class="ruby-keyword kw">begin</span>
              <span class="ruby-identifier">yfrog</span> = <span class="ruby-constant">Nokogiri</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">yfrog</span>.<span class="ruby-identifier">body</span>)
              <span class="ruby-constant">TwitterPhoto</span>.<span class="ruby-identifier">new</span>(
                              <span class="ruby-identifier">yfrog</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">&quot;//meta[@property='og:title']&quot;</span>).<span class="ruby-identifier">attributes</span>[<span class="ruby-value str">'content'</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'.th.jpg'</span>,
                              <span class="ruby-identifier">yfrog</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">&quot;///div[@class='twittertweet']/div/div/div&quot;</span>).<span class="ruby-identifier">text</span>, 
                              <span class="ruby-identifier">yfrog</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">&quot;///div[@class='twittertweet']/div/div/div/div&quot;</span>).<span class="ruby-identifier">text</span>,
                              <span class="ruby-identifier">yfrog</span>.<span class="ruby-identifier">at_xpath</span>(<span class="ruby-value str">&quot;//img[@id='main_image']&quot;</span>)[<span class="ruby-identifier">:src</span>],
                              <span class="ruby-identifier">username</span>
                              )
            <span class="ruby-keyword kw">rescue</span>
            <span class="ruby-keyword kw">end</span>
         <span class="ruby-keyword kw">end</span>
         <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">queue</span> <span class="ruby-identifier">yfrog_request</span>
       <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-identifier">tweetphoto_request</span> = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{TWEETPHOTO_URL}#{username}&quot;</span>, <span class="ruby-identifier">:timeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5000</span>)
    <span class="ruby-identifier">tweetphoto_request</span>.<span class="ruby-identifier">on_complete</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
        <span class="ruby-identifier">tweetphoto_id</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)[<span class="ruby-value str">&quot;Id&quot;</span>]
        <span class="ruby-identifier">tweetphoto_username_request</span> = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{TWEETPHOTO_URL}#{tweetphoto_id}/photos&quot;</span>, <span class="ruby-identifier">:timeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5000</span>)
        <span class="ruby-identifier">tweetphoto_username_request</span>.<span class="ruby-identifier">on_complete</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tweetphoto_username</span><span class="ruby-operator">|</span>
          <span class="ruby-identifier">tweetphotodata</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">tweetphoto_username</span>.<span class="ruby-identifier">body</span>)
          <span class="ruby-identifier">tweetphotodata</span>[<span class="ruby-value str">'List'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tweetphoto</span><span class="ruby-operator">|</span>
            <span class="ruby-constant">TwitterPhoto</span>.<span class="ruby-identifier">new</span>(
                             <span class="ruby-identifier">tweetphoto</span>[<span class="ruby-value str">'ThumbnailUrl'</span>],
                             <span class="ruby-identifier">tweetphoto</span>[<span class="ruby-value str">'Message'</span>],
                             <span class="ruby-identifier">tweetphoto</span>[<span class="ruby-value str">'UploadDateString'</span>],
                             <span class="ruby-identifier">tweetphoto</span>[<span class="ruby-value str">'MediumImageUrl'</span>],
                             <span class="ruby-identifier">username</span>
                            )
          <span class="ruby-keyword kw">end</span>
        <span class="ruby-keyword kw">end</span>
        <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">queue</span> <span class="ruby-identifier">tweetphoto_username_request</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span>
     
    <span class="ruby-identifier">twitgoo_request</span>  = <span class="ruby-constant">Typhoeus</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{TWITGOO_URL}#{username}&quot;</span>, <span class="ruby-identifier">:params</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:format</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'json'</span>}, <span class="ruby-identifier">:timeout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5000</span>)
    <span class="ruby-identifier">twitgoo_request</span>.<span class="ruby-identifier">on_complete</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
        <span class="ruby-identifier">twitgoo</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
        <span class="ruby-identifier">twitgoo</span>[<span class="ruby-value str">'media'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">twit</span><span class="ruby-operator">|</span>
          <span class="ruby-constant">TwitterPhoto</span>.<span class="ruby-identifier">new</span>(
                           <span class="ruby-identifier">twit</span>[<span class="ruby-value str">'thumburl'</span>],
                           <span class="ruby-identifier">twit</span>[<span class="ruby-value str">'text'</span>],
                           <span class="ruby-identifier">twit</span>[<span class="ruby-value str">'created_at'</span>],
                           <span class="ruby-identifier">twit</span>[<span class="ruby-value str">'imageurl'</span>],
                           <span class="ruby-identifier">username</span>
                          )
        <span class="ruby-keyword kw">end</span>
      <span class="ruby-keyword kw">end</span>
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">queue</span> <span class="ruby-identifier">yfrog_request</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:yfrog</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
    <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">queue</span> <span class="ruby-identifier">tweetphoto_request</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:tweetphoto</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
    <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">queue</span> <span class="ruby-identifier">twitpic_request</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:twitpic</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
    <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">queue</span> <span class="ruby-identifier">twitgoo_request</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:twitgoo</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
    <span class="ruby-identifier">hydra</span>.<span class="ruby-identifier">run</span>
    
    <span class="ruby-constant">TwitterPhoto</span>.<span class="ruby-identifier">find_by_username</span>(<span class="ruby-identifier">username</span>)
      
  <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
			<div id="new-method" class="method-detail ">
				<a name="M000000"></a>

				<div class="method-heading">
				
					<span class="method-name">new</span><span
						class="method-args">(thumb=nil, tweet='No tweet for this photo', date=nil, url=nil, username=nil)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p class="missing-docs">(Not documented)</p>
					

					
					<div class="method-source-code"
						id="new-source">
<pre>
<span class="ruby-comment cmt"># File lib/twitter-photos.rb, line 13</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">thumb</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">tweet</span>=<span class="ruby-value str">'No tweet for this photo'</span>, <span class="ruby-identifier">date</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">url</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">username</span>=<span class="ruby-keyword kw">nil</span>)
    <span class="ruby-identifier">date</span> = <span class="ruby-identifier">date</span>.<span class="ruby-identifier">strip</span>
    <span class="ruby-identifier">dmatch</span> = <span class="ruby-identifier">date</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\sago\b/i</span>)
    <span class="ruby-ivar">@username</span>  = <span class="ruby-identifier">username</span>
    <span class="ruby-ivar">@thumb</span> = <span class="ruby-identifier">thumb</span>
    <span class="ruby-ivar">@tweet</span> = <span class="ruby-identifier">tweet</span>.<span class="ruby-identifier">strip</span>
    <span class="ruby-ivar">@date</span>  = <span class="ruby-identifier">dmatch</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span> <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">date</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-constant">DateTime</span>.<span class="ruby-identifier">time_ago_to_date</span>(<span class="ruby-identifier">date</span>).<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-ivar">@date</span> = <span class="ruby-identifier">date</span>
    <span class="ruby-ivar">@url</span>   = <span class="ruby-identifier">url</span>
    <span class="ruby-ivar">@tweet</span> = <span class="ruby-value str">&quot;No tweet for this photo.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@tweet</span>.<span class="ruby-identifier">blank?</span>
  <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

